package com.ucap.weking.guangan.fragments.liveOnlineFrgmentContent;

import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.TextView;

import com.ucap.weking.guangan.R;
import com.ucap.weking.guangan.base.BaseFragment;

/**
 * Created by weking on 2017/11/13.
 */

public class FragmentContent2 extends BaseFragment {
    String date;

    @Override
    public void setData() {
        Log.i("FragmentContentWeb", "setData: " + date);
    }

    public FragmentContent2 setData(String data) {
        this.date = data;
        return this;
    }

    @Override
    public void intiView() {
        if (!TextUtils.isEmpty(date)) {
            WebView webView = new WebView(getContext());
//            webView.setInitialScale(260);
            webView.getSettings().setSupportZoom(true);
            webView.getSettings().setTextZoom(90);
            webView.loadDataWithBaseURL(null, date, "text/html", "utf-8", null);
            flContent.addView(webView);
        } else {
            View view = LayoutInflater.from(getContext()).inflate(R.layout.item_is_err_text_view, null);
            flContent.addView(view);
        }

    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        flContent.removeAllViews();
    }
}
